package com.zivwu.utils.device;


import android.content.pm.PackageManager;

import androidx.core.content.ContextCompat;

import com.zivwu.utils.AppUtils;

/**
 * android permission check
 */
public class PermissionHelper {


    public static boolean hasPermission(String[] permissions) {
        boolean denied = true;
        for (String permission : permissions) {
            denied = denied & hasPermission(permission);
        }
        return denied;
    }

    public static boolean hasPermission(String permission) {
        return ContextCompat.checkSelfPermission(AppUtils.getApp(), permission) == PackageManager.PERMISSION_GRANTED;
    }
}
